package ssm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ssm.dao.TeacherMapper;
import ssm.entity.Teacher;

@Service
public class TeacherService {
	@Autowired
	private TeacherMapper teacherMapper;
	
	/**
	 * 获取某院系的老师
	 * @param dId
	 * @return
	 */
	public List<Teacher> getTeachersByDepartmentId(Integer dId){
		return teacherMapper.getTeachersByDepartmentId(dId);
	}
	
	/**
	 * 获取所有老师
	 * @return
	 */
	public List<Teacher> allTeacher(){
		return teacherMapper.allTeacher();
	}
	
	/**
	 * 添加老师
	 * @param record
	 * @return
	 */
	public int addTeacher(Teacher record) {
		return teacherMapper.addTeacher(record);
	}
	
	/**
	 * 修改老师信息
	 * @param record
	 * @return
	 */
	public int updateTeacherSelective(Teacher record) {
		return teacherMapper.updateTeacherSelective(record);
	}
	
	/**
	 * 删除老师
	 * @param tId
	 * @return
	 */
	public int deleteTeacher(Integer tId) {
		return teacherMapper.deleteTeacher(tId);
	}
	
	/**
	 * 重置老师密码
	 * @param tId
	 * @return
	 */
	public int resetTeacherPassword(Integer tId) {
		return teacherMapper.resetTeacherPassword(tId);
	}
	
}
